<!-- zakaz forma start -->
<hr style="border:1px solid #CCC" />
<?php 
if(isset($_POST['send']))
{
$ism = addslashes(htmlspecialchars($_POST['ism']));
$tel = htmlspecialchars($_POST['tel']);
$email = htmlspecialchars($_POST['email']);
$adres = addslashes(htmlspecialchars($_POST['adres']));
$fikr = addslashes(htmlspecialchars($_POST['fikr']));
$antibot = $_POST['antibot'];

$date_now = date("d-F, Y, H:i");
$saqlash = addslashes($tovarname)." &nbsp; Narx: ".$price; /// $tovarname bu view_tovar sahifasidan

	if(trim($ism) == '')
	{
	$error = ERR_NAME;
	}
	else if(trim($tel) == '')
	{
	$error = ERR_TEL;
	}
	else if(trim($email) == '')
	{
	$error = ERR_EMAIL;
	}
	else if(!preg_match("/([A-Z0-9_-]+\@[A-Z0-9_-]+\.[a-z.]{2,7}+)+$/i",$email))
	{
	$error = ERR_EMAIL2;
	}
	else if(trim($antibot) == '')
	{
	$error = ERR_NOBOT;
	}
	else if(trim($antibot) != BOT)
	{
	$error = ERR_BOT;
	}
	if($error == '')
    {
	/* zakazni bazaga kirit va emailga yubor */
	$natija = mysql_query("INSERT into zakaz(tovar,ism,tel,email,adres,date,text) 
    VALUES('$saqlash', '$ism','$tel','$email','$adres','$date_now','$fikr')");
	if(!$natija) { myerror("Xatolik !!! Siz yuborgan malumotlar qabul qilinmadi,<br> iltimos, bizga qo'ng'iroq qiling");}
// emailga yuboramiz
    $to = "$row_contact->email";
	$to2 = "$row_contact->email2";
    
	$subject = SITEURL." Saytdan tovar zakaz qilindi";
    $message = "Adminga kiring. \n ism:".$ism."\n Tel:".$tel."\n E-Mail:".$email." \n Adres:".$adres."\n Fikr:".$fikr."\n";
    
    mail($to, $subject, $message,"From: $email \r\nReply-To: $email\r\nReturn-Path: $email\r\n");
    mail($to2, $subject, $message,"Content-type:text/plain; Charset=windows-1251 \r\n");
	/* emailga yuborish tamom */
?>
   <div style="font-size:18px; text-align:center; color:#0099CC;">
   		<? echo THANK." " .stripslashes($ism). "<br />". THANK2 ;?><br />
   </div>
<?php
   }
}

if(!isset($_POST['send']) || $error != '')
{
?>
<div class="zakaz">
   <p class="order_title"><?php echo ORDER; ?></p>
   <? if($error) echo "<p class='error'>$error</p>"; ?>
<form action="#form" method="post" name="form_zakaz" onSubmit="return tekshir(this)">
<table width="400" border="0" cellspacing="15" cellpadding="0">
  <tr>
    <td width="200" class="form_r"><?php echo ISM; ?></td>
    <td><input type="text" name="ism" size="30" maxlength="30"  value="<?= stripslashes($ism);?>" />
    </td>
  </tr>
  <tr>
    <td class="form_r"><?php echo TEL; ?></td>
    <td><input type="text" name="tel" size="30" maxlength="30"  value="<?=$tel;?>" />
      <br />
      <span class="minitext"><?php echo MASALAN; ?> (+99897) 123 45 67</span></td>
  </tr>
  <tr>
    <td class="form_r"><?php echo EMAIL; ?></td>
    <td><input type="text" name="email" size="30" maxlength="30" value="<?=$email;?>" /></td>
  </tr>
  <tr>
    <td class="form_r"><?php echo ADRES; ?><br /></td>
    <td><input type="text" name="adres" size="30"  value="<?= stripslashes($adres);?>" />
    <br /><span class="minitext"> <?php echo MASALAN; ?> Toshkent, Yunusobod, 19-kvartal...</span>
    </td>
  </tr>
  <tr>
    <td class="form_r"><?php echo QUSHIMCHA; ?><br /></td>
    <td><textarea name="fikr" cols="30" rows="3" wrap="virtual"><?= stripslashes($fikr);?></textarea>
    <br /><span class="minitext"> <?php echo MASALAN; ?> Qo'shimcha Savol yoki taklif</span>
    </td>
  </tr>
  <tr>
    <td class="form_r"><?php echo ENTER_BOT; ?> <u><?php echo BOT; ?></u></td>
    <td><input type="text" name="antibot" size="7" value="<?=$antibot;?>" /> </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="send" value="<?php echo BUY; ?>" class="submit" style="cursor:pointer;" /></td>
  </tr>
</table>
</form>
</div>
<?php
}
?>
<!-- zakaz forma finish -->